﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdUnitsFormatterTool : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdUnitsFormatterTool(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdUnitsFormatterTool obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdUnitsFormatterTool()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdUnitsFormatterTool(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdUnitsFormatterTool() : this(GlobalsPINVOKE.new_OdUnitsFormatterTool(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static string formatDecimal(double value, int precision, int dimzin, string decsep, string thsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatterTool_formatDecimal__SWIG_0(value, precision, dimzin, decsep, thsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatDecimal(double value, int precision, int dimzin, string decsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatterTool_formatDecimal__SWIG_1(value, precision, dimzin, decsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double angle(char[] buf, bool refuseDots)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_angle__SWIG_0(buf, refuseDots);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double angle(char[] buf)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_angle__SWIG_1(buf);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static int toInt(string sValue, int nMinValid, int nMaxValid)
		{
			int result = GlobalsPINVOKE.OdUnitsFormatterTool_toInt__SWIG_0(sValue, nMinValid, nMaxValid);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static int toInt(string sValue, int nMinValid)
		{
			int result = GlobalsPINVOKE.OdUnitsFormatterTool_toInt__SWIG_1(sValue, nMinValid);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static int toInt(string sValue)
		{
			int result = GlobalsPINVOKE.OdUnitsFormatterTool_toInt__SWIG_2(sValue);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static bool isZero(double v, int precision)
		{
			bool result = GlobalsPINVOKE.OdUnitsFormatterTool_isZero(v, precision);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatArchitectural(bool isNegative, int feet, int entier, int numerator, int denominator, int dimzin, int mode)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatterTool_formatArchitectural(isNegative, feet, entier, numerator, denominator, dimzin, mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static bool negative(char[] buf)
		{
			bool result = GlobalsPINVOKE.OdUnitsFormatterTool_negative(buf);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double integer(char[] buf)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_integer(buf);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double number(char[] buf, bool pHasDot, bool pHasExponent)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_number__SWIG_0(buf, pHasDot, pHasExponent);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double number(char[] buf, bool pHasDot)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_number__SWIG_1(buf, pHasDot);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double number(char[] buf)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_number__SWIG_2(buf);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static void fraction(double value, out int entier, out int numerator, out int denominator, int precision)
		{
			GlobalsPINVOKE.OdUnitsFormatterTool_fraction(value, out entier, out numerator, out denominator, precision);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static double base_denominator(int prec, double arg1)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_base_denominator(prec, arg1);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double linear_denominator(int prec)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_linear_denominator(prec);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static bool digit(char c)
		{
			bool result = GlobalsPINVOKE.OdUnitsFormatterTool_digit(c);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double denominator(int prec)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatterTool_denominator(prec);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static void decomp(double v, out int degs, out int mins, out double secs, int prec)
		{
			GlobalsPINVOKE.OdUnitsFormatterTool_decomp(v, out degs, out mins, out secs, prec);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static string format(int degs, int mins, double secs, int prec)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatterTool_format(degs, mins, secs, prec);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string next(ref string list, string delim)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(list);
			IntPtr value = intPtr;
			string result;
			try
			{
				string text = GlobalsPINVOKE.OdUnitsFormatterTool_next__SWIG_0(ref intPtr, delim);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				result = text;
			}
			finally
			{
				if (intPtr != value)
				{
					list = Marshal.PtrToStringUni(intPtr);
				}
			}
			return result;
		}

		public static string next(ref string list)
		{
			IntPtr intPtr = Marshal.StringToCoTaskMemUni(list);
			IntPtr value = intPtr;
			string result;
			try
			{
				string text = GlobalsPINVOKE.OdUnitsFormatterTool_next__SWIG_1(ref intPtr);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				result = text;
			}
			finally
			{
				if (intPtr != value)
				{
					list = Marshal.PtrToStringUni(intPtr);
				}
			}
			return result;
		}

		public static int countOccurences(string arg0, char delim)
		{
			int result = GlobalsPINVOKE.OdUnitsFormatterTool_countOccurences__SWIG_0(arg0, delim);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static int countOccurences(string arg0)
		{
			int result = GlobalsPINVOKE.OdUnitsFormatterTool_countOccurences__SWIG_1(arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
